home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 1.iso / dist / fw_ddd.idb / usr / freeware / share / ddd-3.3.1 / vsllib / struct.vsl.z / struct.vsl
Text File  |  2001-10-09  |  3KB  |  103 lines

  1. // $Id: struct.vsl,v 1.1 2000/06/09 09:27:28 andreas Exp $
  2. // Draw structograms
  3.  
  4. // Copyright (C) 1993 Technische Universitaet Braunschweig, Germany.
  5. // Written by Andreas Zeller <zeller@gnu.org>.
  6. // 
  7. // This file is part of DDD.
  8. // 
  9. // DDD is free software; you can redistribute it and/or
  10. // modify it under the terms of the GNU General Public
  11. // License as published by the Free Software Foundation; either
  12. // version 2 of the License, or (at your option) any later version.
  13. // 
  14. // DDD is distributed in the hope that it will be useful,
  15. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17. // See the GNU General Public License for more details.
  18. // 
  19. // You should have received a copy of the GNU General Public
  20. // License along with DDD -- see the file COPYING.
  21. // If not, write to the Free Software Foundation, Inc.,
  22. // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23. // 
  24. // DDD is the data display debugger.
  25. // For details, see the DDD World-Wide-Web page, 
  26. // `http://www.gnu.org/software/ddd/',
  27. // or send a mail to the DDD developers <ddd@gnu.org>.
  28.  
  29. #include "std.vsl"
  30. #include "tab.vsl"
  31. #include "slopes.vsl"
  32.  
  33. // Version
  34. struct_version() = "$Revision: 1.1 $";
  35.  
  36. // Structograms
  37.  
  38. // framedListStruct() creates a vertical list, separated by horizontal lines
  39.  
  40. _framedListStruct(stmt) = stmt;
  41. _framedListStruct(stmt, ...) = 
  42.   _framedListStruct(stmt)
  43. | hrule()
  44. | _framedListStruct(...);
  45.  
  46. framedListStruct(...) = 
  47.   vfix(_framedListStruct(...));
  48.  
  49.  
  50. // topLoopStruct() creates a while loop
  51.  
  52. topLoopStruct(cond, body) =
  53.   cond
  54. | indent(hrule() | vrule() & body);
  55.  
  56.  
  57. // bottomLoopStruct() creates a do-while loop
  58.  
  59. bottomLoopStruct(body, cond) =
  60.   indent(vrule() & body | hrule())
  61. | cond;
  62.  
  63.  
  64. // topBottomLoopStruct() creates a loop with entry and exit conditions
  65.  
  66. topBottomLoopStruct(cond1, body, cond2) =
  67.   cond1
  68. | indent(hrule() | vrule() & body | hrule())
  69. | cond2;
  70.  
  71.  
  72. // fallStruct() creates a box separated by a diagonal line `\'
  73. // riseStruct() creates a box separated by a diagonal line `/'
  74.  
  75. _fallStruct(sw, ne) =
  76.   fall() ^ sw_flush(sw) ^ ne_flush(ne) ^ (sw + ne + rulethickness()) 
  77. | hrule();
  78. fallStruct(sw, ne) = _fallStruct(sw, ne);
  79.  
  80. _riseStruct(nw, se) = 
  81.   rise() ^ nw_flush(nw) ^ se_flush(se) ^ (nw + se + rulethickness())
  82. | hrule();
  83. riseStruct(nw, se) = _riseStruct(nw, se);
  84.  
  85.  
  86. // testStruct() creates a test box
  87.  
  88. testStruct(cond, leftbody, rightbody, leftlabel, rightlabel) =
  89.  
  90.   let width = hspace(leftlabel | leftbody | rightlabel | rightbody | cond) in
  91.  
  92.   let height = vspace((leftlabel & rightlabel) | cond) in
  93.  
  94.   let ltop = width ^ fall() ^ sw_flush(leftlabel),
  95.       rtop = width ^ rise() ^ se_flush(rightlabel),
  96.       top = ((ltop & rtop) ^ n_flush(cond)) ^ height in
  97.  
  98.   let lbottom = leftbody ^ width,
  99.       rbottom = rightbody ^ width,
  100.       bottom = (lbottom & vrule() & rbottom) in
  101.  
  102.   top | hrule() | bottom;
  103.